<html>
<head><title>Panic Menu</title>
<link rel="stylesheet" type="text/css" href="../css/Default.css" />
<Script language="javascript" src="../data/password.js"></script>
<Script language="javascript" src="../exec/login.js"></script>
<noscript>
location.href="../noscript.html";
</noscript>
<SCRIPT LANGUAGE="JavaScript">
	window.onload = redir(0);
//name of cookie: 'eomdmf'
</SCRIPT>
<!-- Add their ip and date to file -->
<?php
$i = $_GET['Panic'];
$cookie = $_COOKIE['eomdmf'];
//echo realpath("../exec/");
require("../exec/GetRoot.php");

if($i != 0 && $cookie == $root_user.":".$root_pass) //Checks if user is the root user
{
	$fh = fopen("msg".$i.".txt", "r");
	if($fh==false){
		echo $i;
		die("unable to open file");
	}
	$msg = trim(fgets($fh));//MESSAGE HERE[*]
	fclose($fh);

	$fh = fopen("ENGAGE.js", "w");//We wanted to name it something epic.
	if($fh==false){
		die("unable to create file");
	}
	fwrite($fh,"var Panic_Mode=true;");//Set it to true is panic is engaged
	fclose($fh);
	
	$fh = fopen("Msg.js", "w");
	if($fh==false){
		die("unable to create file");
	}
	fwrite($fh,"var msg=\"".$msg."\";");
	fclose($fh);

	$fh = fopen("Colours.php", "w");
	if($fh==false)
	{
		die("unable to create file");
	}
	switch($i) //Changes the colour values based on which panic is selected.
	{
		case 1:
			$w = '
			$bgcolor = "#FF0000";
			$font_color = "#FFFFFF";
			$font_color2 = "#000000";
			';
			break;
		case 2:
			$w = '
			$bgcolor = "#747170";
			$font_color = "#FFFFFF";
			$font_color2 = "#000000";
			';
			break;			
		case 3:
			$w = '
			$bgcolor = "#302217";
			$font_color = "#FFFFFF";
			$font_color2 = "#FFFF00";
			';
			break;			
		case 4:
		case 5:
			$w = '
			$bgcolor = "#006600";
			$font_color = "#bfae20";
			$font_color2 = "#FFFFFF";
			';
			break;
	}
	fwrite($fh, '<?php'.$w.'?>');
	fclose($fh);
	
	
}
?>
</HEAD>
<body >
<fieldset style="border-color:bfae20">
	<font size="3.5" face="Arial">
	<b>
	Panic Menu
	</b>
	</font>
<center>
<table border="0">
<tr>
<td>
<center>
	<FORM METHOD="LINK" ACTION="../index.html">
	<INPUT TYPE="submit" VALUE="Home Page">
	</FORM>

	<FORM METHOD="LINK" ACTION="../LoggedIn.php">
	<INPUT TYPE="submit" VALUE="Main Menu">
	</FORM>
	
	<FORM METHOD="LINK" ACTION="../PanicMenu.html">
	<INPUT TYPE="submit" VALUE="Panic Menu">
	</FORM>
</center>	
</td>
</tr>
</table>
</center>
</fieldset>

<center>
<img src= "../media/Gold_Lion.jpg"/>
</center>
</body>
</html>
